package com.taotao.portal.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.portal.service.ContentService;

@Controller
public class IndexController {
	@Autowired
	private ContentService contentService;
	
	/**
	 * 商城首页打开并加载轮播广告内容
	 * @param model
	 * @return
	 * @author: JSJ
	 */
	@RequestMapping("/index")
	public String showIndex(Model model) {
		String json = contentService.getAd1List();
		model.addAttribute("ad1", json);
		return "index";
	}
    /**
     * 测试httpClient POST请求
     * @param name
     * @param password
     * @return
     * @author: JSJ
     */
	@RequestMapping(value = "posttest", method = RequestMethod.POST)
	@ResponseBody
	public String postTest(String name, String password) {
		System.out.println(name);
		System.out.println(password);
		return "ok";
	}
}
